namespace ghost
{
    /**全局字典配置，目前只有飘字配置，配合飘字组件使用*/
    export class SkinDictionary
    {
        public static fillNum:{} = {};   
        public static fillNum2:{} = {};        
        public static init()
        {
            let i:number,len:number;
            let imgData:ImageLabelData;
            let charCode:number;
            let str:string;
            str = "0123456789";
            let normalSizeW:number[],normalSizeH:number[],offsetX:number[],offsetY:number[];
            normalSizeW = [37,37,37,37,37,37,37,37,37,37];
            normalSizeH = [44,44,44,44,44,44,44,44,44,44];
            offsetX = [-19,-19,-19,-19,-19,-19,-19,-19,-19,-19];
            offsetY = [-14,-14,-14,-14,-14,-14,-14,-14,-14,-14];
            for(i=0;i<str.length;++i)
            {
                charCode = str.charCodeAt(i);
                imgData = new ImageLabelData;					
                imgData.setTo(Main.instance.getRes(Conf.num + i + ".png"),normalSizeW[i],normalSizeH[i],offsetX[i],offsetY[i]);	
                SkinDictionary.fillNum[charCode]=imgData;                
            }

            normalSizeW = [26,26,26,26,26,26,26,26,26,26];
            normalSizeH = [36,36,36,36,36,36,36,36,36,36];
            offsetX = [-7,-7,-7,-7,-7,-7,-7,-7,-7,-7];
            offsetY = [0,0,0,0,0,0,0,0,0,0];
            for(i=0;i<str.length;++i)
            {
                charCode = str.charCodeAt(i);
                imgData = new ImageLabelData;					
                imgData.setTo(Main.instance.getRes(Conf.num2 + i + ".png"),normalSizeW[i],normalSizeH[i],offsetX[i],offsetY[i]);	
                SkinDictionary.fillNum2[charCode]=imgData;                
            }
        }        
		public static getNumSkin(skin:number):any
        {
            return SkinDictionary.fillNum;
        }
        public static getSeqTextures(name:string, frameLen:number=15):Laya.Texture[]
        {
            let i:number,len:number;
            let arr:Laya.Texture[] = [];
            len = frameLen;
            for(i=0;i<len;++i)
            {
                arr.push(Main.instance.getRes(`${Conf.seq}${name}/${i}.png`));
            }
            return arr;
        }
    }
}